package com.aternity.geolocations;

import com.infomatiq.jsi.Rectangle;

import java.awt.geom.Rectangle2D;

/**
 * @author Daniel Orr
 */
public class JsiUtils {

    public static Rectangle toJsiRectangle(Rectangle2D rectangle2d) {
        float minX = (float) rectangle2d.getX();
        float minY = (float) rectangle2d.getY();
        float maxX = (float) (rectangle2d.getX() + rectangle2d.getWidth());
        float maxY = (float) (rectangle2d.getY() + rectangle2d.getHeight());
        return new Rectangle(minX, minY, maxX, maxY);
    }

    public static String formatJsiRectangle(Rectangle jsiRectangle){
        return "["+jsiRectangle.minX+", "+jsiRectangle.minY+", "+jsiRectangle.maxX+", "+jsiRectangle.maxY+"]";
    }
}
